﻿//
// Copyright (c) 2024 BPer
//

#include <bpercapture/BPerCaptureFactory.h>

#if BPer_OS_WIN
#include <bperaudiodev/win/BPerWinAudioCapture.h>
#include <bperaudiodev/win/BPerWinAudioApiDevice.h>
#include <bperaudiodev/win/BPerAudioCaptureWindows.h>
#include "win/BPerVideoCaptureWindows.h"
#else
#if BPer_OS_ANDROID
#include <bperaudiodev/android/BPerAudioCaptureAndroid.h>
#include <bpercapture/android/BPerVideoCaptureAndroid.h>
#else
#include <bperaudiodev/linux/BPerAudioAecLinux.h>
#include <bperaudiodev/linux/BPerAudioCaptureLinux.h>
#include <bpercapture/linux/BPerVideoCaptureLinux.h>
#endif
#endif
#if BPer_OS_APPLE
#include <bperaudiodev/mac/BPerAudioCaptureMac.h>
#include <bpercapture/mac/BPerVideoCaptureMac.h>
#endif
BPerCaptureFactory::BPerCaptureFactory() {


}

BPerCaptureFactory::~BPerCaptureFactory() {

}

BPerAudioCapture* BPerCaptureFactory::createAudioCapture(BPerContext *pcontext){
#if BPer_OS_WIN
	return new BPerWinAudioApiDevice(pcontext,0,true);
	// return new BPerWinAudioCapture(pcontext);
#else

#if BPer_OS_ANDROID
	return NULL;
#else
    #if BPer_OS_APPLE
        return NULL;
    #else
        return new BPerAudioAecLinux(&pcontext->avinfo,&pcontext->synMgr);//new BPerAlsaHandle(pcontext);//BPerAudioCaptureImpl(pcontext);
    #endif
#endif
#endif

}
BPerAudioCapture* BPerCaptureFactory::createRecordAudioCapture(BPerAVInfo *avinfo){
#if BPer_OS_WIN
	 return new BPerAudioCaptureWindows(avinfo);
	 //return new BPerWinAudioApiDevice(pcontext,1);
#else
#if BPer_OS_ANDROID
	 return new BPerAudioCaptureAndroid(avinfo);
#else
    #if BPer_OS_APPLE
        return new BPerAudioCaptureMac(avinfo);
    #else
         return new BPerAudioCaptureLinux(avinfo);//new BPerAlsaHandle(pcontext);//BPerAudioCaptureImpl(pcontext);
    #endif
#endif
#endif
}



BPerMultiVideoCapture* BPerCaptureFactory::createVideoCapture(BPerVideoInfo *pcontext){
#if BPer_OS_WIN
	return new BPerVideoCaptureWindows(pcontext);

#else
#if BPer_OS_ANDROID
	return NULL;
#else
    #if BPer_OS_APPLE
        return NULL;
    #else
        return new BPerVideoCaptureLinux(pcontext);
    #endif
#endif
#endif
}
BPerMultiVideoCapture* BPerCaptureFactory::createRecordVideoCapture(BPerVideoInfo *pcontext){
#if BPer_OS_WIN
	return new BPerVideoCaptureWindows(pcontext);
#else
#if BPer_OS_ANDROID
	return NULL;
#else
    #if BPer_OS_APPLE
        return new BPerVideoCaptureMac(pcontext);
    #else
        return new BPerVideoCaptureLinux(pcontext);
    #endif
#endif
#endif
}
BPerMultiVideoCapture* BPerCaptureFactory::createRecordVideoCaptureAndroid(BPerVideoInfo *pcontext,void* pwindow){
#if BPer_OS_ANDROID
	return new BPerVideoCaptureAndroid(pcontext,pwindow);
#else
	return NULL;
#endif
}

